package com.central.scheduler.remote.command.alert;

import com.central.scheduler.remote.command.Command;
import com.central.scheduler.remote.command.CommandType;
import com.central.scheduler.remote.utils.JsonSerializer;

import java.io.Serializable;

/**
 * @author Tindy
 * @date 2021/10/29
 * @describe
 */
public class AlertSendRequestCommand implements Serializable {

    private int groupId;

    private String title;

    private String content;

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public AlertSendRequestCommand(){

    }

    public AlertSendRequestCommand(int groupId, String title, String content) {
        this.groupId = groupId;
        this.title = title;
        this.content = content;
    }

    /**
     * package request command
     *
     * @return command
     */
    public Command convert2Command() {
        Command command = new Command();
        command.setType(CommandType.ALERT_SEND_REQUEST);
        byte[] body = JsonSerializer.serialize(this);
        command.setBody(body);
        return command;
    }
}

